package com.zjp.bio.netbase;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class UseInet {


    public static void main(String[] args) throws UnknownHostException {
        InetAddress address = InetAddress.getByName("www.baidu.com");
        System.out.println(address);

        InetAddress address2 = InetAddress.getByName("123.103.13.50");
        System.out.println(address2.getHostName());

        InetAddress[] allByName = InetAddress.getAllByName("www.baidu.com");
        for (InetAddress inetAddress : allByName) {
            System.out.println(inetAddress);
        }
        byte[] bytes = {(byte) 123, (byte) 103, 13, 50};
        InetAddress byAddress = InetAddress.getByAddress(bytes);
        System.out.println(byAddress);
    }
}
